<?php
class comment_controller_admin_signature extends AdminController{

		public 	$adminstate;
		public	$data;
		public 	$pageinfo;
		public  $searchdata ;
		public  $act;
		public function __construct($app, $controller)
		{
				parent::__construct($app, $controller);

				$this->adminstate = new comment_model_adminstate();

		}

		//取得状态数据
		public function index_action()
		{
				$page = _('page', 1);
			    $verify = _('verify',0); $isdelete = _('isdelete',0); if(!$isdelete) $isdelete = 0;
				$result = $this->adminstate->getStateDate($page,$verify,$isdelete);
				$this->pageinfo = $this->genPages($result['INFO'], array());
				$this->data = $result['ROWS'];
		}
		
		//搜索状态
		public function searchStateDate_action()
		{
			
				$page = _('page', 1);
				$uid  = _('uid', 0);
				$starttime	= _('start', 0);
				$endtime	= _('ende', 0);
				$result		= $this->adminstate->searchStateDate($page , $uid , $starttime , $endtime);
				$this->pageinfo = $this->genPages($result['INFO'], array('page'=>$page, 'uid'=>$uid, 'starttime'=>$starttime, 'endtime'=>$endtime ));
				$this->data		= $result['ROWS'];
				$this->view		= 'index';
		}
		
			//审核 删除 操作
	public  function check_verify_action()
	{
			$verify = _('verify');
			$pass_str = ''; $del_str = '';
			foreach ($verify as $key=>$v) {
				if ($v == 1) { $del_str .= $key.',';  } //删除
				if ($v == 0) { $pass_str .= $key.',';  } //通过
			}
			if($del_str)  {
				$del_str = substr($del_str,0,-1);
				$this->adminstate->adminDelState($del_str);
			}
			if($pass_str) {
				$pass_str = substr($pass_str,0,-1);
				$this->adminstate->passNoverify($pass_str);
			}
			$data['verify'] = 0 ;   $data['isdelete'] = 0 ;
			$this->act = $data;
			$this->view = 'submit';
	}
		
		//后台通过审核
		public function admindverify_action()
		{
				$this->_renderJSON();
				$ids = _('id',0);
				$result = $this->adminstate->passNoverify($ids);
				$this->ret = self::success($result);
		}

		
		
		//未审核数据
		public function NoVerify_action()
		{		
				$page	= _('page', 1);
				$result = $this->adminstate->getNoverifyData($page);
				$this->pageinfo = $this->genPages($result['INFO'], array());
				$this->data = $result['ROWS'];
				$this->view = 'index';
		
		}

		//通过审核数据
		public function passVerify_action()
		{
				$page	= _('page', 1);
				$result = $this->adminstate->getPassverifyData($page);
				$this->pageinfo = $this->genPages($result['INFO'], array());
				$this->data = $result['ROWS'];
				$this->view = 'index';
			
		}
		
		//后台删除数据
		public function delshow_action()
		{
				$page	= _('page', 1);
				$result = $this->adminstate->getAdmindelData($page);
				$this->pageinfo = $this->genPages($result['INFO'], array());
				$this->data = $result['ROWS'];
				$this->view = 'index';			
		}
		
		//统计数据
		public function statistics_action()
		{
				$this->data = $this->adminstate->allStateCount();
				if ($_POST['action'] && $_POST['action'] == 'search'){
					$starttime	= isset($_POST['start']) ? $_POST['start'] : 0 ;
					$endtime	= isset($_POST['end']) ? $_POST['end'] : 0 ;
					$this->searchdata = $this->adminstate->searchstateCount(strtotime($starttime), strtotime($endtime));
//					unset($_POST);
				}
				$this->view = "statistics";
		}
		

}